Vue.use(VueRouter)

const routes = [{
  path: "/home",
  component: () => import("../views/home/Home.vue"),
  meta: {
    keepAlive: false //不需要被缓存的组件
  },
},

{
  path: "/login",
  component: () => import("../views/loginpage/LoginPage.vue"),
  meta: {
    keepAlive: false //不需要被缓存的组件
  },
},
{
  path: "/log",
  name: "log",
  component: () => import("../views/log/Log.vue"),
  meta: {
    keepAlive: true //需要被缓存的组件
  },
},
{
  path: "/message",
  component: () => import("../views/message/Message.vue"),
  meta: {
    keepAlive: true //需要被缓存的组件
  },
},
{
  path: "/archive",
  component: () => import("../views/archive/Archive.vue"),
  meta: {
    keepAlive: true //需要被缓存的组件
  },
},
{
  path: "/backend",
  component: () => import("../views/backend/Backend.vue"),
  meta: {
    keepAlive: true //需要被缓存的组件
  },
},
{
  path: "/",
  redirect: "/home"
},
{
  path: "/article",
  name: 'article',
  component: () => import("../views/article/Article.vue")
},
{
  path: "/musichome",
  component: () => import("../views/music/MusicHome.vue"),
  meta: {
    keepAlive: true //需要被缓存的组件
  },
  redirect: "/musichome/findmusic",
  children: [
    {
      path: 'findmusic',
      component: () => import("../views/music/FindMusic.vue"),
      meta: {
        keepAlive: true //需要被缓存的组件
      },
    },
    {
      path: 'playlist',
      component: () => import("../views/music/PlayList.vue"),
      meta: {
        keepAlive: true //需要被缓存的组件
      },
    },
    {
      path: 'newmusic',
      component: () => import("../views/music/NewMusic.vue"),
      meta: {
        keepAlive: true //需要被缓存的组件
      },
    },
    {
      path: 'musicvideo',
      component: () => import("../views/music/MusicVideo.vue"),
      meta: {
        keepAlive: true //需要被缓存的组件
      },
    },
    {
      path: 'search',
      component: () => import("../views/music/SearchMusic.vue"),
      meta: {
        keepAlive: true //需要被缓存的组件
      },
    },
    {
      path: 'videoinfo',
      component: () => import("../views/music/VideoInfo.vue"),
      meta: {
        keepAlive: false //不需要被缓存的组件
      },
    },
    {
      path: 'listinfo',
      component: () => import("../views/music/MusicList.vue"),
      meta: {
        keepAlive: false //不需要被缓存的组件
      },
    },
    {
      path: 'misiclyrics',
      component: () => import("../views/music/MusicLyrics.vue"),
      meta: {
        keepAlive: false //不需要被缓存的组件
      },
    },
  ]
},
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router